#ifndef _CM0_TIMER_H
#define _CM0_TIMER_H

#include "CMSDK_CM0.h"
/*----------------------------- Common Timer (TIMER) -------------------------------*/

/* timer struct name overwrite */
typedef struct{
	uint32_t TIM_Period;
	uint32_t TIM_Reload;
	uint32_t TIM_CounterSource;
	uint32_t TIM_CounterStart;
	uint32_t TIM_IQR;
	uint32_t TIM_CounterCtrl;
}TIM_InitTypeDef;

#define TIM0            CMSDK_TIMER0
#define TIM1            CMSDK_TIMER1

/* timer init value define */
#define TIM_CounterCtrl_Stop                  ((uint32_t)0x00)
#define TIM_CounterCtrl_Start                 ((uint32_t)0x01)

#define TIM_CounterStart_Internal             ((uint32_t)0x00)
#define TIM_CounterStart_External             ((uint32_t)0x02)

#define TIM_CounterSource_Internal            ((uint32_t)0x00)
#define TIM_CounterSource_External            ((uint32_t)0x04)

#define TIM_CounterIQR_Disable                ((uint32_t)0x00)
#define TIM_CounterIQR_Enable                 ((uint32_t)0x08)


/* common timer function */
void TIM_CommonInit(CMSDK_TIMER_TypeDef * TIMx, TIM_InitTypeDef * pTIM);


#endif
